<clr-datagrid [clrDgLoading]="loading" [(clrDgSelected)]="selected">
    <clr-dg-action-bar>
        <div class="btn-group">
            <button type="button" class="btn btn-sm btn-secondary" (click)="onCreate()">
                <clr-icon shape="plus" size="16"></clr-icon>
                {{"APP_ADD"|translate}}
            </button>
            <button type="button" class="btn btn-sm btn-secondary" (click)="onDelete()" [disabled]="selected.length<1">
                <clr-icon shape="close"></clr-icon>
                {{"APP_DELETE"|translate}}
            </button>
        </div>
    </clr-dg-action-bar>
    <clr-dg-column>{{'APP_NAME'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_CLUSTER'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_ZONE'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_IP'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_CPU'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_HOST_MEMORY'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_GPU'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_OS'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_STATUS'|translate}}</clr-dg-column>
    <clr-dg-column>{{'APP_CREATED_DATE'|translate}}</clr-dg-column>


    <clr-dg-row *clrDgItems="let item of items" [clrDgItem]="item">
        <clr-dg-cell><a (click)="onDetail(item)" href="javascript:void(0)">{{item.name}}</a></clr-dg-cell>
        <clr-dg-cell>{{item.clusterName}}</clr-dg-cell>
        <clr-dg-cell>{{item.zoneName}}</clr-dg-cell>
        <clr-dg-cell>{{item.ip}}</clr-dg-cell>
        <clr-dg-cell>{{item.cpuCore}}</clr-dg-cell>
        <clr-dg-cell>{{item.memory}}</clr-dg-cell>
        <clr-dg-cell>{{item.gpuNum}}</clr-dg-cell>
        <clr-dg-cell>{{item.os}} {{item.osVersion}}</clr-dg-cell>
        <clr-dg-cell>
            <clr-spinner clrAssertive clrInline *ngIf="item.status === 'Initializing'">
                Loading...
            </clr-spinner>
            <span *ngIf="item.status === 'Failed'">
                <clr-icon style="color: red" shape="times"></clr-icon>
                <a href="javascript:void(0)" (click)="onStatusDetail(item)">
                    <span [outerHTML]="item.status | commonStatus"></span>
                </a>
            </span>
            <span *ngIf="item.status !== 'Failed'" [outerHTML]="item.status | commonStatus">
            </span>
        </clr-dg-cell>
        <clr-dg-cell>{{item.createdAt|date:'yyyy-MM-dd HH:mm:ss'}}</clr-dg-cell>
    </clr-dg-row>
    <clr-dg-footer>
        <clr-dg-pagination #pagination [(clrDgPage)]="page" [clrDgPageSize]="size" [clrDgTotalItems]="total"
                           (clrDgPageChange)="refresh()">
            {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
            {{"APP_PAGER_TOTAL"|translate}} {{pagination.totalItems}} {{"APP_HOST"|translate}}
        </clr-dg-pagination>
    </clr-dg-footer>
</clr-datagrid>
